package com.kjtpay.design_pattern.mediator;

/**
 * 国家；Colleague;
 * abstract 只是为了防止实例化
 */
abstract class Country {
    protected String name = "国家的名字";
    // 收到的消息
    protected String receivedMessage = "";
    protected UnitedNations unitedNations;
    public Country(UnitedNations unitedNations) {
        this.unitedNations = unitedNations;
    }

    // 声明，通过联合国传递出去
    public void declare(String message) {
        unitedNations.declare(message, this);
    }

    // 接收消息；一般供联合国（中介者）调用；
    public void getMessage(String message, String sender) {
        receivedMessage = name + "收到来自" + sender + "的信息：" + message + "\n";
    }

    // 名字getter；一般给联合国用
    public String getName() {
        return name;
    }

    // 展示收到的消息
    public String showReceivedMessage() {
        return receivedMessage;
    }

}
